
{extend name=".././view/list.html" /}
{block name="jsset"}
{load href="__STATIC__/echarts/echarts.js" /}
{load href="__STATIC__/echarts/infographic.js" /}
{/block}
{block name="nav"}
<span class="layui-breadcrumb">
	<a href="">成绩查询</a>
	<a><cite>班级成绩</cite></a>
</span>
{/block}
{block name="search"}

<input type="hidden" name="teacher_id" value="{$list.teacher_id}">
{/block}
{block name="table"}
  <table id="tabledemo" lay-filter="mytable" lay-size="sm"></table>
{/block}
{block name="echart"}
<!-- <div class="layui-row" style="padding-top: 80px;"> -->

  <!-- </div> -->
{/block}
{block name="myjs"}
  <!-- 表格上面按钮模板 -->
  <script type="text/html" id="toolbarDemo">
   <div class="layui-btn-container">
		<button class="layui-btn" lay-event="download">
			<i class="layui-icon layui-icon-download-circle"></i> 下载
		</button>
	</div>
</script>
<!-- 记录操作按钮模板 -->
<script type="text/html" id="barDemo">
	<a class="layui-btn-xs" lay-event="detail" title="查看学生成绩"><i class="layui-icon">&#xe62d;</i></a>
</script>
<!-- 表格操作 -->
<script>
	// 设置列
  	options.cols=[[ //表头
    	{type:'numbers',sort:true,width:50,title:'序号'}
      ,{field: 'title',sort:true, title: '荣誉标题', minWidth:250}
      ,{field: 'rongyuce_id',title: '所属荣誉册',sort:true,width:250,templet:function(d){
            var str='';
            if(d.ryTuce)
            {
                str = d.ryTuce.title;
            }
            return str;
        }}
      ,{title: '获奖人',templet:function(d){
            var str='';
            if(d.hjJsry)
            {
                for (var k = 0, length = d.hjJsry.length; k < length; k++) {
                    if(k == 0){
                        str = d.hjJsry[k].teacher.xingming;
                    }else{
                        str =str+'、'+d.hjJsry[k].teacher.xingming;
                    }
                }
            }
            return str;
        }}
      ,{title: '级别',width:100,templet:function(d){
            var str='';
            if(d.ryTuce)
            {
                str = d.ryTuce.fzSchool.dwJibie.title;
            }
            return str;
        }}
      ,{field: 'jiangxiang_id',title: '奖项',sort:true,width:100,templet:function(d){
            var str='';
            if(d.jxCategory)
            {
                str = d.jxCategory.title;
            }
            return str;
        }}
      ,{field: 'hjshijian',sort:true,width:120, title: '获奖时间'}
      ,{title: '发证单位', minWidth: 177,templet:function(d){
            var str='';
            if(d.ryTuce)
            {
                str = d.ryTuce.fzSchool.title;
            }
            return str;
        }}
      ]
    ];


  // 提交搜索条件后重载表格
  layui.use(['table','cjgl','laydate'],function(){
  	var table = layui.table
  	cjgl = layui.cjgl
    laydate = layui.laydate
  	form = layui.form;

    // 添加班级
    // addBanji();
    // loadTubiao()
    //表头工具栏事件
    table.on('toolbar(mytable)', function(obj){
      switch(obj.event){
        case 'dels':
          break;
	        var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值
	        cjgl.delAll(checkStatus,'/school','mytable');
	        break;
	      case 'add':
	        cjgl.add('添加单位','/school/create','650','500');
	        break;
	      case 'download':
          layer.msg('看看就行啦 ^_^');
          break;
	        cjgl.add('下载成绩','/chengji/bjtj/dwbiaoge/' + "{$list.teacher_id}",'650','300');
	        break;
       };
     });

    //监听行工具条
    table.on('tool(mytable)', function(obj){
        var data = obj.data; //获得当前行数据
        var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
        var tr = obj.tr; //获得当前行 tr 的DOM对象
        switch(layEvent){
        	case 'detail':// 查看
            cjgl.addTab('查看学生成绩', '/teachersearchchengji/index/detail/' + data.id, true);
            break;
        	case 'del':// 删除
            cjgl.del(obj,"/school");
            break;
        	case 'edit':// 编辑
            cjgl.add('编辑单位','/school/edit','650','500');
            break;
        	case 'status':// 状态
            cjgl.status(obj,"{:url('setstatus')}");
            break;
        };
      });

    //开始时间
    laydate.render({
      elem: '#bfdate'
      ,type: 'datetime'
      ,trigger: 'click' //采用click弹出
      ,format: 'yyyy-M-d' //可任意组合
      ,done: function(value, date, endDate){
        form.val("search",{
          "bfdate" : value,
        });
        $("#srcsubmit").click();
      }
    });
    //结束时间
    laydate.render({
      elem: '#enddate'
      ,type: 'datetime'
      ,trigger: 'click' //采用click弹出
      ,format: 'yyyy-M-d' //可任意组合
      ,done: function(value, date, endDate){
        form.val("search",{
          "enddate" : value,
        });
        $("#srcsubmit").click();
      }
    });

  });

 </script>
 {/block}
